/*************************************************
Author: byron
Date: 12/15/2013
Description:
Notes: 
*************************************************/

#ifndef __CManorBattleCfg_h__
#define __CManorBattleCfg_h__

#include "commclass.h"
#include "CTArray.h"

class CManorBattleCfgData
{
public:
    CManorBattleCfgData() 
    {
        Clear();
    }

    void Clear()
    {
        _iID = 0;
        _astItemList.Clear();
    }

    virtual ~CManorBattleCfgData() 
    {
    }

    bool IsValidID() const {return (_iID > 0);}
    int CheckValidData();

    int GetID() const {return _iID;}
    void SetID(int iVal) {_iID = iVal;}

    int GetItemSize() const {return _astItemList.Size();}
    CDropItemData& GetItem(int iIndex)
    {
        return _astItemList[iIndex];
    }
    void AddItem(int iType, int iNum, unsigned int uiID) 
    {
        CDropItemData stItemData;
        stItemData._ucItemType = (unsigned char)iType;
        stItemData._usItemConfigID = (unsigned short)uiID;
        stItemData._iItemCount = iNum;
        _astItemList.AddOneItem(stItemData);
    }

private:
    int             _iID;
    CTLib::CTArray<CDropItemData, MAX_MANOR_BATTLE_ITEM_COUNT> _astItemList;
};

class CManorBattleCfg
{
public:
    CManorBattleCfg() 
    {
        Clear();
    }

    void Clear()
    {
        _astCfgList.Clear();
    }

    virtual ~CManorBattleCfg() 
    {
    }

    int GetConfigSize() const {return _astCfgList.Size();}
    int AddConfig(CManorBattleCfgData& stCfgData);
    int FindConfig(int iID);
    CManorBattleCfgData& GetConfig(int iIndex);

private:
    CTLib::CTArray<CManorBattleCfgData, MAX_MANOR_BATTLE_RECORD_COUNT> _astCfgList;
};

#endif // __CManorBattleCfg_h__

